#include "helpbutton.h"

HelpButton::HelpButton(QString buttonText, QGraphicsScene *scene)
    : QGraphicsTextItem(buttonText,0,scene)
{
    setAcceptHoverEvents(true);
    setFont(QFont("Arial Black",25,QFont::Black));
    active = false;
}

void HelpButton::setCurrentlyActive(bool state)
{
    active = state;

    if (active)
        setDefaultTextColor(Qt::red);
    else
        setDefaultTextColor(Qt::black);
}

void HelpButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    emit clicked(this);
}

void HelpButton::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
    setDefaultTextColor(Qt::red);
}

void HelpButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
    if (!active)
        setDefaultTextColor(Qt::black);
}
